using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Net;
using System.Net.Sockets;
using System.Threading;

namespace WPFConsole
{
    public partial class PConsole : Window
    {
        void ChatProtocol(List<string> message)
        {
            string user = message[1];
            string text = "";
            for (int i = 2; i < message.Count; i++)
            {
                text += message[i] + ' ';
            }
            this.WriteLine(user, text);
        }

        void WorldProtocol(List<string> message)
        {
            string text = "";
            for (int i = 1; i < message.Count; i++)
            {
                text += message[i] + ' ';
            }
            this.WriteLine(text);
        }

        void InventoryProtocol(List<string> message)
        {
            this.WorldConsoleBackup = this.CurrentWorldText;
            string text = "*--------------------Inventory--------------------------*\n";
            for (int i = 1; i < message.Count; i++)
            {
                text += message[i] + '\t';
                if (i % 2 == 0) text += "\n";
            }
            text += "\n*-------------------------------------------------------*";
            this.WriteLine(text);
        }

        Sound s;
        void SoundProtocol(List<string> message)
        {
            //this.WriteLine("Will try to play '" + (message[1].Trim().ToLower() + ".mp3") + "' with loop value '" + message[2] + "'");
            s = new Sound(message[1].Trim().ToLower()+".mp3");
            if (Int32.Parse(message[2]) == 1) s.Loop = true;
            s.Play();
        }
    }
}
